<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="main :: common_head">
    <style>
        .changeI {
            display: block;
            width: 100%;
            height: 100%;
        }

        ul li {
            list-style: none;
            margin: 0;
            padding: 0;
        }

        .navbar .nav > li > .dropdown-menu::before {
            display: none !important;
        }

        .navbar .nav > li > .dropdown-menu::after {
            display: none !important;
        }

        .dropdown-menu:hover, .dropdown-menu:hover {
            display: none !important;
        }

        .dropdown-menu:hover::before, .dropdown-menu:hover::after {
            display: none !important;
        }

        #myli > ul:hover::before {
            display: none;
        }
    </style>
</head>

<body>
<!--删除提示模态框-->
<div class="modal fade" id="delcfmModel1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">提示</h4>
            </div>
            <div class="modal-body">是否要删除？</div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="deleteDeviceById()">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<!--删除提示模态框结束-->
<!--删除设备失败提示模态框-->
<div class="modal fade" id="delcfmModel11" tabindex="-1" role="dialog" aria-labelledby="myModalLabel11" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel11">提示</h4>
            </div>
            <div class="modal-body">该设备已在其他图谱中使用，不允许删除！</div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<!--删除设备失败提示模态框结束-->

<div id="app">
<div class="container-fluid-full">
    <div class="row-fluid">
        <noscript>
            <div class="alert alert-block span10">
                <h4 class="alert-heading">Warning!</h4>
                <p>You need to have <a href="" target="_blank">JavaScript</a> enabled to use this site.</p>
            </div>
        </noscript>

        <!-- start: Content -->
        <div id="content" class="span10" style="width: 100%;">
            <ul class="breadcrumb" th:if="${#request.getParameter('breadcrumb') == 'true'}">
                <li>
                    <i class="fas fa-circle-notch"></i>
                    <a id="home" href="#" onclick="parent.location.reload()">主页</a>
                    <i class="icon-angle-right"></i>
                </li>
                <li><a href="#">设备展示</a></li>
            </ul>
            <div class="row-fluid sortable">
                <div class="box span12" >
                    <div class="box-header" data-original-title>
                        <h2><i class="halflings-icon white user"></i><span class="break"></span>设备展示</h2>
                        <div class="box-icon"></div>
                    </div>
                    <div class="box-content" >
                        <!--添加设备开始-->
                        <div class="container" style="margin-left: 0px">
                            <ul id="mytab" class="nav nav-pills nav-justified">
                                <li role="presentation" class="dropdown" id="myli">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" style="border:1px solid black">添加设备<span class="caret"></span></a>
                                    <ul class="dropdown-menu">
                                        <li><a th:href="@{/device/add/1}">产能设备</a></li>
                                        <li><a th:href="@{/device/add/2}">储能设备</a></li>
                                        <li><a th:href="@{/device/add/3}">用能设备</a></li>
                                    </ul>
                                </li>
                            </ul>
                        </div>
                        <!--添加设备结束-->
                        <div class="container" style="margin-left:0px"><!-- 设备列表切换开始 -->
                            <ul id="mytab1" class="nav nav-pills nav-justified" role="tablist">
                                <li role="presentation" class="active" id="ligetAll"><a th:href="@{/device/getAll}">所有设备</a></li>
                                <li role="presentation" id="li1"><a th:href="@{/device/1}">产能设备</a></li>
                                <li role="presentation" id="li2"><a th:href="@{/device/2}">储能设备</a></li>
                                <li role="presentation" id="li3"><a th:href="@{/device/3}">用能设备</a></li>
                            </ul>
                        </div><!-- 设备列表切换结束 -->

                        <!--设备列表开始-->
                        <table class="table table-striped table-bordered bootstrap-datatable datatable" >
                            <thead>
                            <tr>
                                <th>设备ID</th>
                                <th>设备名</th>
                                <th>能量编码</th>
                                <th>电量编码</th>
                                <th>内温编码</th>
                                <th>启动间隔时间</th>
                                <th>是否启用</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="deviceInfoDTO:${deviceInfoDTOS}">
                                <td th:text="${deviceInfoDTO.deviceId}"></td>
                                <td class="center" th:text="${deviceInfoDTO.deviceName}"></td>
                                <td class="center" th:text="${deviceInfoDTO.devName}"></td>
                                <td class="center" th:text="${deviceInfoDTO.batteryName}"></td>
                                <td class="center" th:text="${deviceInfoDTO.temperatureName}"></td>
                                <td class="center" th:text="${deviceInfoDTO.intervalTime}"></td>
                                <td class="center" th:text="${deviceInfoDTO.deviceMonitorSwitch eq 1}?'启用':'停用'"></td>
                                <td class="center">
                                    <!-- 查看字体图标开始-->
                                    <a class="btn btn-success" title="查看"
                                       th:href="@{/device/getDeviceInfo/}+${deviceInfoDTO.deviceId}">
                                        查看
                                    </a>
                                    <!-- 修改字体图标结束-->
                                    <a class="btn btn-info" title="修改" th:href="@{/device/get/}+${deviceInfoDTO.deviceId}">
                                        修改
                                    </a>
                                    <!--<a  class="btn btn-danger" >-->
                                    <!--<i th:id="${device.deviceId}" class="halflings-icon white trash changeI"  onclick="deleteDevice()"></i>-->
                                    <!--</a>-->
                                    <a class="btn btn-danger" href="#" title="删除" th:id="${deviceInfoDTO.deviceId}" onclick="deleteDevice()">删除</a>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <!--设备列表结束-->
                    </div>
                </div>
            </div>
        </div><!--/.fluid-container-->
        <!-- end: Content -->
    </div><!--/#content.span10-->
</div><!--/fluid-row-->
</div>

<div class="modal hide fade" id="myModal">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <h3>Settings</h3>
    </div>
    <div class="modal-body">
        <p>Here settings can be configured...</p>
    </div>
    <div class="modal-footer">
        <a href="#" class="btn" data-dismiss="modal">Close</a>
        <a href="#" class="btn btn-primary">Save changes</a>
    </div>
</div>
<div class="common-modal modal fade" id="common-Modal1" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-content">
        <ul class="list-inline item-details">
            <li><a href="http://sc.chinaz.com">Admin templates</a></li>
            <li><a href="http://sc.chinaz.com">Bootstrap themes</a></li>
        </ul>
    </div>
</div>
<div class="clearfix"></div>

<div th:replace="main::common_js"></div>
<script th:inline="javascript" th:src="@{/js/vue.min.js}"></script>

<script>
    var vm = new Vue({
        el:'#app',
        mounted: function() {
            parent.modifyTitle('设备管理')
        },
    })
</script>

<script th:src="@{/js/detect-element-resize.js}"></script>
<script th:src="@{/js/iframe-resize.js}"></script>

<script>
    //获取当前点击的设备菜单，添加高亮显示
    $(document).ready(function () {
        var location = window.location.href;//获取url
        var id = location.substring(location.lastIndexOf('/') + 1);
        if (id.lastIndexOf('?') != -1) {
            id = id.substring(0, id.lastIndexOf('?'))
        }
        $("#" + "li" + id).addClass("active").siblings().removeClass("active");//给对应的li高亮


    })
</script>
</body>
</html>
